package alex.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.math.BigDecimal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by lushun.chen on 2017/4/27.
 *
 * @author lushun.chen
 */
@SpringBootApplication
public class DemoApp {

    public static void main(String[] args) {
        //SpringApplication.run(DemoApp.class, args);

        BigDecimal decimal = new BigDecimal("3.20");
        String string = decimal.toString();
        if (string.endsWith("00")) {
            System.out.println(string.substring(0, string.length() - 3));
        }
        if (string.endsWith("0")) {
            System.out.println(string.substring(0, string.length() - 1));
        }
    }
}
